package com.cgtong.android.mvp.model;

import com.cgtong.android.bean.RecordBean;
import com.cgtong.android.http.ApiManager;
import com.cgtong.android.mvp.contract.GetScorePageContract;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.SimpleCallBack;
import com.zhouyou.http.exception.ApiException;

import java.util.List;

/**
 * Created by Tinwai on 2017/10/26.
 */
public class GetScorePageModel implements GetScorePageContract.Model {
    @Override
    public void getScoreDatas(int maxId, int pageSize, final SimpleCallBack callBack) {
        EasyHttp.post(ApiManager.URL_GET_SCORES)
                .params("maxId", String.valueOf(maxId))
                .params("pageSize", String.valueOf(pageSize))
                .accessToken(true)
                .execute(new SimpleCallBack<List<RecordBean>>() {
                    @Override
                    public void onError(ApiException e) {
                        callBack.onError(e);
                    }

                    @Override
                    public void onSuccess(List<RecordBean> result) {
                        callBack.onSuccess(result);
                    }
                });
    }
}
